# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Fabian Bornschein <fabiscafe-cat-mailbox-dog-org>

pkgname=gnome-initial-setup
pkgver=45.0
pkgrel=1
pkgdesc='Helps you to set up your OS when you boot for the first time'
arch=('loong64' 'x86_64')
url='https://gitlab.gnome.org/GNOME/gnome-initial-setup'
license=('GPL')
depends=('accountsservice' 'cairo' 'fontconfig' 'gcc-libs' 'gdk-pixbuf2' 'gdm' 'geoclue'
         'geocode-glib-2' 'glib2' 'glibc' 'gnome-desktop-4' 'gnome-control-center' 'gnome-keyring'
         'gnome-online-accounts' 'gsettings-desktop-schemas' 'gtk3' 'gtk4' 'json-glib' 'krb5'
         'libadwaita' 'libgdm' 'libgnomekbd' 'libgoa' 'libgweather-4' 'libibus' 'libmalcontent'
         'libnm' 'libnma-gtk4' 'libpwquality' 'librest' 'libsecret' 'malcontent' 'pango' 'polkit'
         'webkitgtk-6.0')
makedepends=('meson')
source=("https://download.gnome.org/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz")
sha256sums=('b1afe764798f8948bedb95c7ab31bd78529ac5cb481c41f7a7777f264de54bd8')

build() {
  arch-meson $pkgname-$pkgver build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"
  install -d -o root -g 102 -m 750 "$pkgdir/usr/share/polkit-1/rules.d"

  # Setup system user and group
  echo 'u gnome-initial-setup - "GNOME Initial Setup" /run/gnome-initial-setup' |
    install -Dm644 /dev/stdin "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
  echo 'd /run/gnome-initial-setup 0700 gnome-initial-setup gnome-initial-setup -' |
    install -Dm644 /dev/stdin "$pkgdir/usr/lib/tmpfiles.d/$pkgname.conf"
}
